package com.xone.xapp;
import org.json.JSONObject;

public class AutoCompleteListHolder extends BasicListHolder {
	protected String name;
	protected String dateCreated;
	protected String saleType;
	protected static final String PURCHASE_TYPE = "3";
	public AutoCompleteListHolder(JSONObject jSONObject, String saleType) {
		this.saleType = saleType;
		name = JSONUtils.getStringFromJSONObject(jSONObject, getNameKey());
	}
	public String getNameKey() {
		if (PURCHASE_TYPE.equals(saleType)) {
			return "purchaseName";
		}
		return "productName";
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setDateCreated(String dateCreated) {
		this.dateCreated = dateCreated;
	}
	public String getSaleType() {
		return saleType;
	}
	public void setSaleType(String saleType) {
		this.saleType = saleType;
	}
	@Override
	public String getDateCreated() {
		return this.dateCreated;
	}
	@Override
	public String getDataCreatedName() {
		if (PURCHASE_TYPE.equals(saleType)) {
			return "purchase.dateCreated";
		}
		return "product.dateCreated";
	}
}
